﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebshopPizzaRio.App_Code.DAL.PizzaDALTableAdapters;
using WebshopPizzaRio.App_Code.DAL.AanbiedingenDALTableAdapters;
using WebshopPizzaRio.App_Code.DAL;
using System.Data;

namespace WebshopPizzaRio
{
    public class PizzaBLL
    {
        private pizzaTableAdapter adapter = new pizzaTableAdapter();
        private aanbiedingenTableAdapter adapteraanbieding = new aanbiedingenTableAdapter();
        private ingredientenTableAdapter ingredientenadapter = new ingredientenTableAdapter();
        private pizzaregelTableAdapter pizzaregeladapter = new pizzaregelTableAdapter();

        public App_Code.DAL.PizzaDAL.pizzaDataTable getPizza()
        {
            return adapter.GetDataByAllPizza();
        }

        public int getAantalSamenGesteldePizza(Guid userid)
        {
            return (int)adapter.GetCountAantalSamenGesteldePizza(userid);
        }

        public App_Code.DAL.AanbiedingenDAL.aanbiedingenDataTable getAanbiedingen()
        {
            return adapteraanbieding.GetDataAlleaanbiedingen();
        }

        public App_Code.DAL.PizzaDAL.ingredientenDataTable getIngredienten()
        {
            return ingredientenadapter.GetData();
        }

        public App_Code.DAL.PizzaDAL.ingredientenDataTable getIngredientenBYNR(int ingredientnummer)
        {
            return ingredientenadapter.GetDataByOneIngredientNR(ingredientnummer);
        }

        public void InsertPizzaRegel(int pizzaid, int ingredientnr, String hoeveelheid)
        {
            pizzaregeladapter.InsertIntoPizzaRegel(pizzaid, ingredientnr, hoeveelheid);
        }

        public void InsertPizza(int pizzaid, String naam, double prijs, int pizzasamengesteld, int publiekelijk, Guid userid)
        {
            adapter.InsertIntoPizzaSamengesteld(pizzaid, naam, prijs, pizzasamengesteld, publiekelijk, userid, DateTime.Now.ToString());
        }

        public int getNewPizzaID()
        {
            return (int)adapter.GetNewPizzaID();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable getPizzaSamengesteld()
        {
            return adapter.GetDataByPizzaSamengesteld();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable getPizzaIDS()
        {
            return adapter.GetDataByAllPizzaID();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable getPizzaByUserID(Guid userid)
        {
            return adapter.GetDataByPizzaUserID(userid);
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable sorterenopnaamAZ()
        {
            return adapter.sorterenopnaamAZ();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable sorterenopnaamZA()
        {
            return adapter.sorterenopnaamZA();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable sorterenopprijshoog()
        {
            return adapter.sorterenopprijshoog();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable sorterenopprijslaag()
        {
            return adapter.sorterenopprijslaag();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable sorterenopbestsellermeest()
        {
            return adapter.sorterenopbestsellermeest();
        }

        public App_Code.DAL.PizzaDAL.pizzaDataTable PizzaZoeken(string searchpizza)
        {
            return adapter.SearchPizza(searchpizza);
        }
    }
}